#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<errno.h>
#include<fcntl.h>
#include<unistd.h> 
#include<pthread.h>

#define N 1

int
main(int argc, char* args[])
{
	int fd1 = open(args[1], O_RDONLY);
	if(fd1 == -1){
		perror("open args[1] falied");
		exit(errno);
	}
	 

	int fd2 = open(args[2], O_WRONLY | O_CREAT | O_TRUNC, 0755);	
	if(fd2 == -1){
		perror("open args[2] falied");
		exit(errno);
	}

	char buffer[N];

	while(int n = read(fd1, buffer, N)){
		write(fd2, buffer, n);	
	}

	if(close(fd1) == -1) strerror(errno);
	close(fd2);
	

	exit(0);	
}
